package com.hmall.common.client.item;

import com.hmall.common.dto.PageDTO;
import com.hmall.common.dto.item.ItemDTO;
import com.hmall.common.interceptor.MyFeignInterceptor;
import com.hmall.common.pojo.item.Item;
import feign.Request;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

@FeignClient(name = "itemservice",configuration = {MyFeignInterceptor.class})
public interface ClientFeign {

    //根据商品id查询商品
    @GetMapping("/item/{id}")
    public Item seleceById(@RequestParam("id") Long id);

    //商品分页查询
    @GetMapping("/item/list")
    public PageDTO<Item> itemList(@RequestParam("page") Integer page,@RequestParam("size") Integer size);

    /**
     * 新增商品
     */
    @PostMapping("/item")
    public void addItem(@RequestBody ItemDTO itemDTO);

    //商品上下架
    @PutMapping("/item/status/{id}/{status}")
    public void updataItem(@PathVariable Long id, @PathVariable Integer status);

    //修改商品
    @PutMapping("/item")
    public void updata(@RequestBody ItemDTO itemDTO);

    //根据id删除商品
    @DeleteMapping("/item/{id}")
    public void deleteItem(@PathVariable Long id);

}
